package o;

import android.content.ContentResolver;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull;
import java.io.FileNotFoundException;
import java.io.IOException;
import o.sg.d;

public abstract class sr<T> implements sg<T> {
    private final Uri ˊ;
    private T ˎ;
    private final ContentResolver ˏ;

    protected abstract T ˊ(Uri uri, ContentResolver contentResolver) throws FileNotFoundException;

    protected abstract void ˊ(T t) throws IOException;

    public sr(ContentResolver contentResolver, Uri uri) {
        this.ˏ = contentResolver;
        this.ˊ = uri;
    }

    public final void ˏ(@NonNull rl rlVar, @NonNull d<? super T> dVar) {
        try {
            this.ˎ = ˊ(this.ˊ, this.ˏ);
            dVar.ॱ(this.ˎ);
        } catch (Throwable e) {
            if (Log.isLoggable("LocalUriFetcher", 3)) {
                Log.d("LocalUriFetcher", "Failed to open Uri", e);
            }
            dVar.ˏ(e);
        }
    }

    public void ˏ() {
        if (this.ˎ != null) {
            try {
                ˊ(this.ˎ);
            } catch (IOException e) {
            }
        }
    }

    public void ॱ() {
    }

    @NonNull
    public rz ˎ() {
        return rz.LOCAL;
    }
}
